<script setup>
import { RouterLink, RouterView } from 'vue-router'
import store from './store';
import axios from "axios";
store.sendAct()

// import { ref, reactive } from "vue";
// console.log(JSON.parse(window.localStorage.getItem("user")));
console.log(window.localStorage.getItem("user"))
if (window.localStorage.getItem("user")=="undefined"||window.localStorage.getItem("user")==null) {
  console.log("token not foundddddd")
}
// console.log("1")
else {
  axios({
    url: "http://8.130.46.21:8000/decode/token/?token=" + JSON.parse(window.localStorage.getItem("user")).token,
    method: "get"
  }).then((res) => {
    // token_pass = res.data;
    // console.log(token_pass)
    // // const token_pass = await axios.get("http://192.168.53.106:8000/decode/token/?token=1")
    // console.log("2")
    // console.log(token_pass)
    //后端校验token，通过则直接跳转Home
    if (
      res.data.pass == "true"
    ) {
      //改为Home
      window.localStorage.setItem("user", JSON.stringify(res.data));
      window.location.replace("src/pages/Home/Home.html");
      console.log(qqqqq)
    }
  });
}
// 几个小事项，有需要注意的在这写:
// 1,打包后的字体图标路径是错误的，需要手动改(已改为cdn引入)
// 2,开始项目先json-server --host 192.168.x.x data/db.json
// 3,打包后，运行一下   "../../../public"改为"../../.."   在public里面的文件地址均需改  
</script>

<template>
<!-- 测试转跳 -->
<router-view></router-view>
</template>


<style>

</style>